<template>
  <div class="payment-group youke">
    <Navs left to="/user"></Navs>
    <Main>
      <template slot="main">
        <div class="inputs-group">
          <van-cell
            title="绑定微信"
            :value="wxValue"
            is-link
            :to="wxValue=='未绑定'?'/user/paymentedit?pay=1':'/user/paymentdetail?pay=1'"
          >
            <img slot="icon" class="payment-icons" src="@/assets/user/zf-a.png">
          </van-cell>
          <van-cell
            title="绑定支付宝"
            :value="alipay"
            is-link
            :to="alipay=='未绑定'?'/user/paymentedit?pay=2':'/user/paymentdetail?pay=2'"
          >
            <img slot="icon" class="payment-icons" src="@/assets/user/zf-b.png">
          </van-cell>
          <van-cell
            title="绑定银行卡"
            :value="bankCard"
            is-link
            :to="bankCard=='未绑定'?'/user/paymentedit?pay=3':'/user/paymentdetail?pay=3'"
          >
            <img slot="icon" class="payment-icons" src="@/assets/user/zf-c.png">
          </van-cell>
        </div>
      </template>
    </Main>
  </div>
</template>

<script type="text/ecmascript-6">
import { user } from "@/api";
export default {
  //接收父级传递的参数
  props: [],
  //监听数据变化
  watch: {},
  data() {
    return {
      wxValue: "已绑定",
      alipay: "未绑定",
      bankCard: "未绑定"
    };
  },
  //实例初始化之前触发事件
  beforeCreate() {},
  //实例化之后触发事件
  created() {
     this.getlist();
  },
  //实时监控data参数数据变化
  computed: {},
  //模板组件
  components: {},
  //执行方法
  methods: {
    getlist() {
      user.bindpay().then(res => {
        if (res.code == 1000) {
          this.wxValue = res.result.wx == 1 ? "已绑定" : "未绑定";
          this.alipay = res.result.zfb == 1 ? "已绑定" : "未绑定";
          this.bankCard = res.result.yhk == 1 ? "已绑定" : "未绑定";
        }
      });
    }
  },
  mounted() {
   
  }
  //路由退出时候调用
  //beforeRouteLeave(to, from, next){next()}
};
</script>

<style scoped lang="less">
.payment-group {
  .payment-icons {
    display: block;
    vertical-align: middle;
    margin-top: 0.2rem;
    margin-right: 0.3rem;
    width: 1.375rem;
    height: 1.375rem;
  }
}
</style>
